<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" width="70%" destroy-on-close @closed="$emit('closed')" align-center>
        <el-main style="height:640px">
            <sc-table ref="table" :data="data" stripe remoteSort border showSummary hidePagination hideDo>
                <el-table-column label="工厂货号" prop="factory_number" align="center"></el-table-column>
                <el-table-column label="批次号" prop="batch_number" align="center"></el-table-column>
                <el-table-column label="条码编号" align="center">
                    <template #default="{row}">
                        {{row.barcode}}
                    </template>
                </el-table-column>
                <el-table-column label="工序" prop="process_title" align="center"></el-table-column>
                <el-table-column label="颜色" prop="colour" align="center"></el-table-column>
                <el-table-column label="尺码" prop="goods_size" align="center"></el-table-column>
                <el-table-column label="数量" prop="num" align="center"></el-table-column>
                <el-table-column label="重量" prop="weight" align="center"></el-table-column>
                <el-table-column label="超数(+)" prop="overnumber" align="center"></el-table-column>
                <el-table-column label="超重(+)" prop="overweight" align="center"></el-table-column>
                <el-table-column label="备注" prop="remark" align="center"></el-table-column>
            </sc-table>
        </el-main>
        <template #footer>
			<el-button @click="visible = false">取 消</el-button>
		</template>
	</el-dialog>
</template>

<script>
    export default {
        emits: ['success', 'closed'],
        data() {
            return {
                mode: "add",
                titleMap: {
                    add: '收货明细',
                    edit: '收货明细',
                    show: '查看'
                },
                visible: false,
                isSaveing: false,
                data:[]
            }
        },
        methods: {
            //显示
            open(mode = 'add') {
                this.mode = mode;
                this.visible = true;
                return this
            },
            //表单注入数据
            async setData(data) {
                let array = []
                var res = await this.$API.produce.send.detailLists.get({deliver_no:data.deliver_no,contract_no:data.contract_no});
                res.data.rows.map(item=>{
                    array.push({
                        contract_no : item.contract_no,
                        barcode : item.barcode,
                        batch_number : item.batch_number,
                        colour : item.colour,
                        factory_number : item.factory_number,
                        process_title : item.two_process_title,
                        goods_size : item.goods_size,
                        num : item.num,
                        weight : item.weight,
                        overnumber : item.over_num,
                        overweight : item.over_weight,
                        remark : item.remark
                    })
                })
                this.data = array
            },
        }
    }
</script>

<style></style>
